import 'dart:convert';

AssessmentEditDto assessmentDtoFromJson(String str) =>
    AssessmentEditDto.fromJson(json.decode(str));

String assessmentDtoToJson(AssessmentEditDto data) => json.encode(data.toJson());

class AssessmentEditDto {
  AssessmentEditDto({
    this.operationType,
    this.id,
    this.instruction,
    this.assessmentName,
    this.textType,
    this.audioType,
    this.dueDate,
    this.startDate,
    this.type,
    this.studentUserNames,
    this.questionGroupIds,
  });

  String? operationType;
  String? id;
  dynamic instruction;
  String? assessmentName;
  String? textType;
  String? audioType;
  String? dueDate;
  String? startDate;
  Type? type;
  List<Type>? studentUserNames;
  List<QuestionGroupId>? questionGroupIds;

  factory AssessmentEditDto.fromJson(Map<String, dynamic> json) => AssessmentEditDto(
        operationType: json["operationType"],
        id: json["id"],
        instruction: json["instruction"],
        assessmentName: json["assessmentName"],
        textType: json["textType"],
        audioType: json["audioType"],
        dueDate: json["dueDate"],
        startDate: json["startDate"],
        type: Type.fromJson(json["type"]),
        studentUserNames: json["studentUserNames"] != null
            ? List<Type>.from(
                json["studentUserNames"].map((x) => Type.fromJson(x)))
            : null,
        questionGroupIds: json["questionGroupIds"] != null
            ? List<QuestionGroupId>.from(json["questionGroupIds"]
                .map((x) => QuestionGroupId.fromJson(x)))
            : null,
      );

  Map<String, dynamic> toJson() => {
        "operationType": operationType,
        "id": id,
        "instruction": instruction,
        "assessmentName": assessmentName,
        "textType": textType,
        "audioType": audioType,
        "dueDate": dueDate,
        "startDate": startDate,
        "type": type?.toJson(),
        "studentUserNames": studentUserNames != null
            ? List<dynamic>.from(studentUserNames!.map((x) => x.toJson()))
            : [],
        "questionGroupIds": questionGroupIds != null
            ? List<dynamic>.from(questionGroupIds!.map((x) => x.toJson()))
            : [],
      };
}

class QuestionGroupId {
  QuestionGroupId({
    this.id,
    this.title,
  });

  String? id;
  String? title;

  factory QuestionGroupId.fromJson(Map<String, dynamic> json) =>
      QuestionGroupId(
        id: json["id"],
        title: json["title"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "title": title,
      };
}

class Type {
  Type({
    this.value,
    this.label,
  });

  String? value;
  String? label;

  factory Type.fromJson(Map<String, dynamic> json) => Type(
        value: json["value"],
        label: json["label"],
      );

  Map<String, dynamic> toJson() => {
        "value": value,
        "label": label,
      };
}
